<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="shortcut icon" href="<!--{eval echo register_static('img/touch-icon-57x57.png');}-->">
    <title>粉粉管理系统</title>

    <!-- Bootstrap core CSS -->
    <link href="<!--{eval echo register_static('css/bootstrap.min.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/bootstrap-reset.css');}-->" rel="stylesheet">
    <!--Animation css-->
    <link href="<!--{eval echo register_static('css/animate.css');}-->" rel="stylesheet">
    <!--Icon-fonts css-->
    <link href="<!--{eval echo register_static('assets/font-awesome/css/font-awesome.css');}-->" rel="stylesheet" />
    <link href="<!--{eval echo register_static('assets/ionicon/css/ionicons.min.css');}-->" rel="stylesheet" />
    <link href="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.css');}-->" rel="stylesheet">
    <!-- Plugins css -->
    <link href="<!--{eval echo register_static('assets/modal-effect/css/component.css');}-->" rel="stylesheet">
    <!-- DataTables -->
    <link rel="stylesheet" href="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.css" rel="stylesheet');}-->" />
    <!-- Custom styles for this template -->
    <link href="<!--{eval echo register_static('css/style.css');}-->" rel="stylesheet">
    <link href="<!--{eval echo register_static('css/helper.css');}-->" rel="stylesheet">
    <!-- My styles for this template -->
    <link href="<!--{eval echo register_static('css/common.css');}-->" rel="stylesheet"></head>

<body>

    <!-- Aside Start-->
    <!--{template admin_v2/leftside}-->
    <!-- Aside Ends-->

    <!--Main Content Start -->
    <section class="content">

        <!-- Header -->
        <!--{template admin_v2/header}-->
        <!-- Header Ends -->

        <!-- Page Content Start -->
        <!-- ================== -->

        <div class="wraper container-fluid user-list">
            <div class="row">
                <div class="col-md-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">{$goods_name}商店</h3>
                        </div>
                        <br/>    
                          <button class="btn btn-primary" data-toggle="modal" data-target="#add{$goods}">添加</button>                  
					       <div id="add{$goods}" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="custom-width-modalLabel" aria-hidden="true" style="display: none;">
                             <div class="modal-dialog" style="width:65%;">
                                 <div class="modal-content">
                                 <form action="admin.php" method="get" id="addsourcedata">
                                     <div class="modal-header">
                                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                         <h4 class="modal-title" id="custom-width-modalLabel">添加{$goods_name}包</h4>
                                     </div>
                                     <div class="modal-body">
                                      	<div class="row"> 
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labelid" class="control-label">id号</label>                            
                                                  	  <input class="form-control" id="labelid" type="text"  placeholder="id" name="id">
                                                  </div> 
                                              </div> 
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labelname" class="control-label">名称</label>                                                     
                                                      <input class="form-control" id="labelname" type="text" placeholder="name" name="name">
                                                  </div> 
                                              </div> 
                                          </div>                                         
                                           <div class="row"> 
                                              <div class="col-md-4"> 
                                                  <div class="form-group"> 
                                                      <label for="labeltag" class="control-label">标签</label> 	
                                                  	  <select name="tag" class="form-control" id="labeltag">
                                                  	    <option value="">无</option>
                                                  	    <option value="new">最新</option>
														<option value="hot">最热</option>
													  </select>
                                    	          </div> 
                                              </div> 
                                              <div class="col-md-4"> 
                                                  <div class="form-group"> 
                                                      <label for="labelstatus" class="control-label">状态</label>                                                                         	 
                                                  	  <select name="status" class="form-control" id="labelstatus">
														<option value="1">下架</option>
														<option value="0">上架</option>
													  </select>
                                                  </div> 
                                              </div> 
                                              <div class="col-md-4"> 
                                                  <div class="form-group"> 
                                                      <label for="labelname_tag" class="control-label">类别</label>       
                                                      <select name="name_tag" class="form-control" id="labelname_tag">
														<option value="0">静图</option>
														<option value="1">动图</option>
													  </select>
                                                  </div> 
                                              </div> 
                                          </div> 
                                        
                                          <div class="row"> 
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labelexpire_time" class="control-label">有效期</label> 	
                                                  	  <input class="form-control" id="labelexpire_time" value="0" type="text" placeholder="有效期" name="expire_time">
                                    	          </div> 
                                              </div> 
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labelprice_orign" class="control-label">原价</label> 
                                                      <input class="form-control" id="labelprice_orign" value="0" type="text" placeholder="原价(粉币)" name="price_orign">
                                                  </div> 
                                              </div> 
                                          </div>
                                          <div class="row"> 
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labelprice_final" class="control-label">促销价</label> 	
                                                  	  <input class="form-control" id="labelprice_final" value="0" type="text" placeholder="折扣/会员价(粉币)" name="price_final">
                                    	          </div> 
                                              </div> 
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labeldesc" class="control-label">介绍</label> 
                                                      <input class="form-control" id="labeldesc" type="text" placeholder="介绍" name="desc">
                                                  </div> 
                                              </div> 
                                          </div>
                                          <div class="row"> 
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labelcover" class="control-label">封面</label> 	
                                                  	  <input class="form-control" id="labelcover" type="text" placeholder="封面" name="cover">
                                    	          </div> 
                                              </div>
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labeluid" class="control-label">作者</label> 
                                                      <input class="form-control" id="labeluid" value="3"  type="text" placeholder="作者UID" name="cuid" >
                                                  </div> 
                                              </div> 
                                          </div>
                                           <div class="row"> 
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labeldownload_url" class="control-label">包地址</label> 	
                                                  	 	<input class="form-control" id="labeldownload_url" type="text" placeholder="包地址" name="download_url">
                                    	          </div> 
                                              </div> 
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labelthumbnail_m" class="control-label">预览图</label> 
                                                      <input class="form-control" id="labelthumbnail_m" type="text" placeholder="预览图" name="thumbnail_m">
                                                  </div> 
                                              </div> 
                                          </div>
                                          <div class="row"> 
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labelthumbnail_s" class="control-label">预览小图</label> 	
                                                  	 <input class="form-control" id="labelthumbnail_s" type="text" placeholder="预览小图" name="thumbnail_s">
                                    	          </div> 
                                              </div> 
                                              <div class="col-md-6"> 
                                                  <div class="form-group"> 
                                                      <label for="labeltask" class="control-label">任务说明(1等级;2达人;3粉币)</label> 
                                                     <input class="form-control" id="labeltask" type="text" placeholder="任务说明" name="task">
                                                  </div> 
                                              </div> 
                                          </div>
				  					</div>
							   <div class="modal-footer">
							   		<input  type="hidden"  name="sale_amount" value="0"/>
							   		<input  type="hidden"  name="zip_size" value="1024"/>
							   		<input  type="hidden"  name="ac" value="shop_class"/>
							   		<input  type="hidden"  name="op" value="add{$goods}"/>
								    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
								    <button type="button" id="addsource" class="btn btn-primary">添加</button>
							   </div>
							   </form>
                                       
                        </div><!-- /.modal-content -->
                         </div><!-- /.modal-dialog -->
                     </div><!-- /.modal -->
   											
                        <div class="panel-body">                  
                            <div class="row">
                                <div class="col-md-12 col-sm-12 col-xs-12">
                                    <table id="datatable" class="table table-striped table-bordered">
                                        <thead>
                                            <tr>
                                            	<th style="width:5%">
                                                	<div class="btn-group">
													  <button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
													    批量操作 <span class="caret"></span>
													  </button>
													  <ul class="dropdown-menu">
													    <li><a href="#" class='batchAction'  data-type='online'>资源上线</a></li>
													    <li><a href="#" class='batchAction' data-type='offline'>资源下线</a></li>
													    <li><a href="#" class='batchAction' data-type='common'>普通类型</a></li>
													    <li><a href="#" class='batchAction' data-type='vip'>vip类型</a></li>
													    <li><a href="#" class='batchAction' data-type='new'>标签最新</a></li>
													    <li><a href="#" class='batchAction' data-type='hot'>标签最热</a></li>
													    <li><a href="#" class='batchAction' data-type='notag'>去除标签</a></li>
													  </ul>
													</div>
                                                </th>
                                            	<th>ID</th>
                                                <th>封面</th>
                                                <th>名称</th>
                                                <th>任务</th>
                                                <th>价格</th>
                                                <th>状态</th>
                                                <th>标签</th>
                                                <th>下载量</th>
                                                <th>编辑</th>                                                                                       
                                            </tr>
                                        </thead>
                                       <tbody>
                                         	<!--{loop $list $value}-->
										<tr>
											<th>
												<label class="cr-styled">
	                                            <input type="checkbox" class="batch" data-id="{$value[id]}">
	                                            <i class="fa"></i>                
	                                       		 </label>
											</th>
											<th><!--{$value[id]}--></th>
											<th><img height="40px" src="{$value[cover_s]}"/></th>
											<th>{$value[name]}</th>
											<th>
												<!--{if $value[task][type]}-->
												<span class="label label-danger">限制,{$value[task][desc]}</span>
												<!--{else}-->
												
												<span class="label label-info">无任务限制</span>
												<!--{/if}-->
											</th>
											<th>
												<!--{if $value[price_final] > 0}-->
													<span class="badge badge-important">{$value[price_final]}</span> 金币
												<!--{else}-->
													免费
												<!--{/if}-->
											</th>
											<th>
												<!--{if $value[status] == 0}-->
													<i class="ion-checkmark-round"></i>
												<!--{else}-->
													<i class="ion-close-round"></i>
												<!--{/if}-->
											</th>
									        <th><!--{$value['tag'][0][bg]}--></th>
											<th><!--{$value['sale_amount']}--></th>		
											<th data-id="{$value[id]}" data-op="get{$goods}Detail" >
												<a href="javascript:void(0);" class="on-default edit-row btn btn-default btn-sm getshopdetail"  ><i class="fa fa-pencil"></i></a>
												<!--{if $_GET[op]== 'getSkinList'}-->
												<a   style="height:30px;" href="admin.php?pid={$value[id]}&ac=shop_class&op=getShopzipList" class="btn btn-primary">查看皮肤包</a>
												<!--{/if}-->
                                                <!--{if $_GET[op] == 'getEmotionList' || $_GET[op]=='getPaperList'}-->
                                                    <span class="nav_right"><a href="javascript:void(0);"  style="height:29px;" class="btn btn-primary btn-middle packaging" data-sid="{$value[id]}" >打包</a>
                                                        <!--{if empty($value[download_url])}-->
								                            未打包
                                                        <!--{else}-->
								                            已打包
                                                        <!--{/if}-->
                                                    </span>
                                                <!--{/if}-->
                                                <span class="nav_right"><a href="admin.php?ac=shop_class&op=get{$goods}CountList&id={$value['id']}&name={$value['name']}" target="_blank" style="height:29px;" class="btn btn-primary btn-middle">查看下载量</a></span>
											</th>
										</tr>
										<!--{/loop}-->
					                     </tbody>
					              </table>
                                         <!--{if $pageUrl}-->
                                         <ul class="pager">
                                             <li>
                                                 <a href="{$pageUrl['prev']}">
                                                     <i class="fa fa-angle-double-left"></i> 上一页
                                                 </a>
                                             </li>
                                             <li>
                                                 <a href="{$pageUrl['first']}">
                                                     <i class="fa"></i> 第一页
                                                 </a>
                                             </li>
                                             <li>
                                                 <a href="{$pageUrl['next']}"> 下一页
                                                     <i class="fa fa-angle-double-right"></i>
                                                 </a>
                                             </li>
                                         </ul>
                                         <!--{/if}--> </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
                <!-- Page Content Ends -->
                <!-- ================== -->

            
                <!-- Footer Start -->
                <!--{template admin_v2/footer}-->
                <!-- Footer Ends --> </section>
            <!-- Main Content Ends -->

            <!-- js placed at the end of the document so the pages load faster -->
            <script src="<!--{eval echo register_static('js/jquery.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/bootstrap.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/pace.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/wow.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('js/jquery.nicescroll.js');}-->" type="text/javascript"></script>

            <script src="<!--{eval echo register_static('js/jquery.app.js');}-->"></script>
			<script src="<!--{eval echo register_static('js/handlebars-v4.0.5.js');}-->"></script>
			<script src="<!--{eval echo register_static('js/handlebars-helper.js');}-->"></script>
			<script src="<!--{eval echo register_static('layer/layer.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/datatables/dataTables.bootstrap.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.init.js');}-->"></script>

            <!-- Modal-Effect -->
            <script src="<!--{eval echo register_static('assets/modal-effect/js/classie.js');}-->"></script>
            <script src="<!--{eval echo register_static('assets/modal-effect/js/modalEffects.js');}-->"></script>
    <script type="text/template" id="pack">
        {{#.}}
        <form   style="margin-left: 10px;"  role="form" method="post" action='admin.php?ac=pack&op=submit' enctype="multipart/form-data">
                <div class="form-group">
                    <label for="ids">ID</label>
                    <input type="text" id="ids" class="form-control" name="id" value={{this.id}} >
                </div>

                <div class="form-group">
                    <label for="pinname">拼音名称</label>
                    <input type="text"  id="pinname" class="form-control" name="name" placeholder="请输入名称拼音">
                </div>
                <div class="form-group">
                    <label for="inputfile">选择包文件
                    </label>
                    <input type="file" id="inputfile" name="package">
                </div>
                <input type="hidden" name="type" value="{{this.packtype}}">
                <button type="submit" class="btn btn-info layerwait" >执行</button>
        </form>
        {{/.}}
    </script>
            <script  type="text/template" id="editsource">
           			{{#.}}
						<div class="container">
                         <form action="admin.php" method="get" id="editsourcedata">
                              	<div class="row"> 
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labelid" class="control-label">id号</label>                            
                                          	  <input class="form-control" id="labelid" type="text"  placeholder="id" name="id" value="{{detail.id}}">
                                          </div> 
                                      </div> 
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labelname" class="control-label">名称</label>                                                     
                                              <input class="form-control" id="labelname" type="text" placeholder="name" name="name" value="{{detail.name}}" >
                                          </div> 
                                      </div> 
                                  </div>                                         
                                   <div class="row"> 
                                      <div class="col-md-3"> 
                                          <div class="form-group"> 
                                              <label for="labeltag" class="control-label">标签</label> 	
                                          	  <select name="tag" class="form-control" id="labeltag">
												<option value="">无</option>
                                          	    <option value="new" {{detail.tag_css.new}}>最新</option>
												<option value="hot" {{detail.tag_css.hot}}>最热</option>
					  						  </select>
                            	          </div> 
                                      </div> 
                                      <div class="col-md-3"> 
                                          <div class="form-group"> 
                                              <label for="labelstatus" class="control-label">状态</label>                                                                         	 
                                          	  <select name="status" class="form-control" id="labelstatus">
												<option value="1" {{detail.status_css.[1]}}>下架</option>
												<option value="0" {{detail.status_css.[0]}}>上架</option>
					  						  </select>
                                          </div> 
                                      </div> 
                                      <div class="col-md-3"> 
                                          <div class="form-group"> 
                                              <label for="labelname_tag" class="control-label">类别</label>       
                                              <select name="name_tag" class="form-control" id="labelname_tag">
												<option value="0" {{detail.name_tag_css.[0]}}>静图</option>
												<option value="1" {{detail.name_tag_css.[1]}}>动图</option>
					 						 </select>
                                          </div> 
                                      </div> 
                                        <div class="col-md-3"> 
                                          <div class="form-group"> 
                                              <label for="labelvip" class="control-label">V I P</label>       
                                              <select name="vip" class="form-control" id="labelvip">
												<option value="0" {{detail.vip_css.[0]}}>普通</option>
												<option value="1" {{detail.vip_css.[1]}}>VIP</option>
					 						 </select>
                                          </div> 
                                      </div> 
                                  </div> 
                                
                                  <div class="row"> 
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labelexpire_time" class="control-label">有效期</label> 	
                                          	  <input class="form-control" id="labelexpire_time" type="text" placeholder="有效期" name="expire_time" value="{{detail.expire_time}}">
                            	          </div> 
                                      </div> 
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labelprice_orign" class="control-label">原价</label> 
                                              <input class="form-control" id="labelprice_orign"  type="text" placeholder="原价(粉币)" name="price_orign" value="{{detail.price_orign}}">
                                          </div> 
                                      </div> 
                                  </div>
                                  <div class="row"> 
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labelprice_final" class="control-label">促销价</label> 	
                                          	  <input class="form-control" id="labelprice_final"  type="text" placeholder="折扣/会员价(粉币)" name="price_final" value="{{detail.price_final}}" >
                            	          </div> 
                                      </div> 
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labeldesc" class="control-label">介绍</label> 
                                              <input class="form-control" id="labeldesc" type="text" placeholder="介绍" name="desc" value="{{detail.desc}}">
                                          </div> 
                                      </div> 
                                  </div>
                                  <div class="row"> 
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labelcover" class="control-label">封面</label> 	
                                          	  <input class="form-control" id="labelcover" type="text" placeholder="封面" name="cover" value="{{detail.cover}}">
                            	          </div> 
                                      </div>
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labeluid" class="control-label">作者</label> 
                                              <input class="form-control" id="labeluid"  type="text" placeholder="作者UID" name="cuid" value="{{detail.cuid}}">
                                          </div> 
                                      </div> 
                                  </div>
                                   <div class="row"> 
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labeldownload_url" class="control-label">包地址</label> 	
                                          	 	<input class="form-control" id="labeldownload_url" type="text" placeholder="包地址" name="download_url" value="{{detail.download_url}}">
                            	          </div> 
                                      </div> 
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labelthumbnail_m" class="control-label">预览图</label> 
                                              <input class="form-control" id="labelthumbnail_m" type="text" placeholder="预览图" name="thumbnail_m" value="{{detail.thumbnail.m}}">
                                          </div> 
                                      </div> 
                                  </div>
                                  <div class="row"> 
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labelthumbnail_s" class="control-label">预览小图</label> 	
                                          	 <input class="form-control" id="labelthumbnail_s" type="text" placeholder="预览小图" name="thumbnail_s" value="{{detail.thumbnail.s}}">
                            	          </div> 
                                      </div> 
                                      <div class="col-md-6"> 
                                          <div class="form-group"> 
                                              <label for="labeltask" class="control-label">任务说明(1等级;2达人;3粉币)</label> 
                                             <input class="form-control" id="labeltask" type="text" placeholder="任务说明" name="task" value="{{detail.taskdesc}}">
                                          </div> 
                                      </div> 
                                  </div>		

  	<input type="hidden" name="ac" value="shop_class"/>
	<input type="hidden" name="op" value="edit{{{goods}}}"/>
	<input type="hidden" name="id" value="{{{detail.id}}}"/>
	<button type="button" style="float:right" id="editsource" class="btn btn-primary">提交</button>
  </form>
</div>
					{{/.}}
           </script>
         	<script type="text/javascript">
            $(document).ready(function() {
                // 设置table配置
                $('#datatable').dataTable({
                    "iDisplayLength": 50,
                    "aLengthMenu": [10, 20, 50, 100],
                    "searching": false,
                    "bLengthChange" : false,
                    "bSort" : false,
                    "bPaginate": false
                });
            
            });
            $(document).on('click','.layerwait',function () {
               var index = layer.load();
            })
            $(document).off('.packaging').on('click','.packaging',function(){
                        var id = parseInt($(this).data('sid'));

                        if(id>10000 && id < 20000){
                            var packType = '0';
                        }else if(id >20000 && id < 30000){
                            var packType = '1';
                        }
                        var data={'id':id,'packtype':packType};
                        var packaging = Handlebars.compile($('#pack').html());
                       layer.open({
                           type: 1,
                          title:'开始打包',
                          skin: 'layui-layer-demo', //样式类名
                          closeBtn: 1, //显示关闭按钮
                          shift: 2,
                          area:['400px',"300px"],
                          shadeClose: true, //开启遮罩关闭
                          content: packaging(data)
                         });

            });
         	$(document).on('click','#editsource',function(){
         	   //编辑    
         	   		 var data=$("#editsourcedata").serialize()
         	   		 layer.closeAll()
                	 swals(data);	                  
         	});
         	
         	$(document).on('click','#addsource',function(){
          	   //增加    
          	   		 layer.closeAll()
          	   	     swals($("#addsourcedata").serialize());	                
          	});
                                                                      
            //批量操作
           	ids=[];
           	$('.batch').click(function(){
           		var id = $(this).data('id');
           		var index = $.inArray(id,ids);
      			if(index !== -1){
      				ids.splice(index,1);
      				$(this).attr('checked',false);
      			}else{
      				ids.push(id);
      				$(this).attr('checked',true);
      			}
      			
           	});
           	
           
        	$('.batchAction').click(function(){
             	
         		var actionType= $(this).data('type');
         		
         		if(typeof(actionType) == undefined){
         			layer.alert('类型选择有误！');
         			return false;
         		}
         		
         		if(ids.length==0){
         			layer.alert('请先勾选资源！');
         			return false;
         		}
         		
         		swals({'ids' : ids,'actionType':actionType,'editType':'edit{$goods}','op':'setBatchData'});                   	
         	}); 
         
        	//获取资源详情
            var tp_editsource = Handlebars.compile($('#editsource').html());  
            $(".getshopdetail").click(function() {
            	var shop = $(this).parent().data();
            	var id   = shop.id;
            	var op   = shop.op;
				var index= layer.load();
        		$.ajax(
    		            {
    		                url     :   "admin.php",
    		                type    :   "GET",
    		                data    :   {'id' : id,'ac':'shop_class','op':op},
    		                success :   function(data)
    		                            {	
    		                				var html = tp_editsource(data)        		                				
    		                				layer.close(index);
    		                				layer.open({
    		                					  type: 1,
    		                					  title:'编辑'+data.goods_name,
    		                					  skin: 'layui-layer-demo', //样式类名
    		                					  closeBtn: 1, //显示关闭按钮
    		                					  shift: 2,
    		                					  area:['65%',"70%"],
    		                					  shadeClose: true, //开启遮罩关闭
    		                					  content: html
    		                					});       		                			
    		                            }
    		            });
       		});

          var swals = function (data, url, title, text){
                    if (url === undefined) {
                        url = "admin.php?ac=shop_class";
                    }
                    if (title === undefined) {
                        title = "确认操作?";
                    }
                    if (text === undefined) {
                        text  = "请慎重操作!";
                    }
                    swal(
                            {
                                title: title,
                                text: text,
                                type: "warning",
                                showCancelButton: true,
                                confirmButtonColor: "#DD6B55",
                                confirmButtonText: "Sure!",
                                closeOnConfirm: false
                            },
                            function(){
                                $.ajax(
                                        {
                                            dataType:   "json",
                                            url     :   url,
                                            type    :   "GET",
                                            data    :   data,
                                            success :   function(data)
                                            {
                                                if(data==1){
                                                    swal("操作完成!", "", "success");
                                                }else{
                                                    swal("操作失败!", "", "error");
                                                }
                                                refresh();
                                            }
                                        });
                            });
                }
            // 刷新当前页面
            var refresh=  function (){
                setInterval(window.location.reload(),5000);
            }
         	
        </script>
</body>
        </html>